package creation_patterns.singleton_pattern.hunger;


public class HungerSingletonBlock {

    private HungerSingletonBlock() {
    }

    private static HungerSingletonBlock hungerSingletonBlock;

    // 用静态代码块的方式实现，实际上和静态常量是一个概念，没有本质上的差别，只是代码的实现方式不一样
    static {
        hungerSingletonBlock = new HungerSingletonBlock();
    }

    public static HungerSingletonBlock getInstance() {
        return hungerSingletonBlock;
    }
}
